<template>
    <div id="system" class="warp system">
        <postHead active="home" :showAction="true"></postHead>

        <div class="container">
            <div class="addjob wrap_panel">
                <div class="panel panel-default">
                    <div class="panel-heading">新增岗位</div>
                    <div class="panel-body">

                        <!-- 新增岗位 -->
                        <div class="register-info">
                            <form class="form-horizontal">


                                <div class="register-tag">悬赏金额</div>
                                <div class="form-group">
                                    <label class="register-form-label control-label">金额</label>
                                    <div class="register-form-control">
                                        <input id="professionalneed" type="number" style="width: 200px;"
                                            class="form-control" placeholder="请输入悬赏金额"
                                            v-model="form.infoRewardSet.money">
                                        <span style="margin-left:5px">元</span>

                                        <!-- <i class="el-icon-question" style="margin-left: 5px;color: #888888;cursor: pointer;font-size:20px"></i> -->

                                        <el-popover placement="right-start" width="600" title="悬赏金规则" trigger="click">
                                            <div class="rule_content" v-html="contentMain">

                                            </div>
                                            <span style="color:#409EFF;margin-left:10px;cursor: pointer;"
                                                slot="reference">悬赏金规则</span>
                                        </el-popover>
                                    </div>
                                </div>
                                <div class="register-tag">基本信息</div>

                                <div class="form-group">
                                    <label class="register-form-label control-label" style="font-weight:bold">
                                        <span class="required">*</span>工作地点</label>

                                    <div class="register-form-control">
                                    
                                            <div class="addmain">

                                                <div class="am_left">
                                                    <select-address :addressData="workSelect" @sureAddress="sureAddress($event,workSelect)" :chinaData="chinaData" :otherData="otherData"></select-address>
                                                </div>



                                               


                                            </div>
                                      

                                    </div>

                                </div>


                                <div class="form-group">
                                    <label class="register-form-label control-label" style="font-weight:bold"><span
                                            class="required">*</span>招聘数量</label>
                                    <div class="register-form-control">
                                        <input type="number" v-model="form.num" placeholder="请输入招聘数量"
                                            class="form-control">
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="register-form-label control-label">
                                        <span class="required"></span>招聘原因
                                    </label>
                                    <div class="register-form-control">
                                        <el-select v-model="form.reason" placeholder="请选择" style="width: 450px;">
                                            <el-option v-for="item in dictInfo.reason" :key="item.value"
                                                :label="item.label" :value="item.value">
                                            </el-option>
                                        </el-select>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="register-form-label control-label">
                                        <span class="required"></span>紧急程度
                                    </label>
                                    <div class="register-form-control">
                                        <el-select v-model="form.urgency" placeholder="请选择" style="width: 450px;">
                                            <el-option v-for="item in dictInfo.urgency" :key="item.value"
                                                :label="item.label" :value="item.value">
                                            </el-option>
                                        </el-select>


                                    </div>
                                </div>








                                <div class="form-group">
                                    <label class="register-form-label control-label" style="font-weight:bold">
                                        <span class="required">*</span>岗位名称
                                    </label>
                                    <div class="register-form-control">
                                        <input id="jobname" type="text" class="form-control" placeholder="请输入岗位名称"
                                            v-model="form.name">

                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="register-form-label control-label">
                                        <span class="required"></span>岗位图片
                                    </label>
                                    <div class="register-form-control">
                                        <a class="BusinessLicense" v-if="form.postImg"> <img :src="form.postImgUrl"
                                                style="height: 90px; width: 160px">
                                            <span @click="deleteImg">删除</span></a>

                                        <div class="upload_div">
                                            <i class="el-icon-plus"></i>
                                            <input type="file" accept="image/*" @change="changeFile">
                                        </div>

                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="register-form-label control-label">
                                        <span class="required"></span>岗位标语
                                    </label>
                                    <div class="register-form-control"
                                        style="border: 1px solid #e6e6e6;width: 450px;margin-left: 15px;">

                                        <Toolbar style="border-bottom: 1px solid #ccc" :editor="editor"
                                            :defaultConfig="toolbarConfig" :mode="mode" />
                                        <Editor style="height: 60px; overflow-y: hidden" v-model="form.jobSlogan"
                                            @onCreated="onCreated" :defaultConfig="editorConfig" :mode="mode" />

                                        <!-- <input id="jobname" type="text" class="form-control" placeholder="请输入岗位标语" v-model="form.jobSlogan"> -->

                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="register-form-label control-label" style="font-weight:bold">
                                        <span class="required">*</span>岗位类型
                                    </label>
                                    <div class="register-form-control">
                                        <el-select v-model="form.postType" placeholder="请选择" style="width: 450px;">
                                            <el-option v-for="item in dictInfo.postType" :key="item.value"
                                                :label="item.label" :value="item.value">
                                            </el-option>
                                        </el-select>


                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="register-form-label control-label">
                                        <span class="required"></span>所属公司
                                    </label>
                                    <div class="register-form-control">

                                        <el-select v-model="form.companyId" placeholder="请选择" style="width: 450px;">
                                            <el-option v-for="item in companyList" :key="item.id" :label="item.name"
                                                :value="item.id">
                                            </el-option>
                                        </el-select>

                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="register-form-label control-label">
                                        <span class="required"></span>所属部门
                                    </label>
                                    <div class="register-form-control">
                                        <input id="jobname" type="text" class="form-control" placeholder="请输入所属部门"
                                            v-model="form.department">

                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="register-form-label control-label">
                                        <span class="required"></span>部门介绍
                                    </label>
                                    <div class="register-form-control">
                                        <textarea class="form-control" placeholder="请输入部门介绍"
                                            v-model="form.departmentIntroduction"></textarea>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="register-form-label control-label" style="font-weight:bold">
                                        <span class="required">*</span>岗位职级
                                    </label>
                                    <div class="register-form-control">
                                        <el-select v-model="form.positionRank" placeholder="请选择" style="width: 450px;">
                                            <el-option v-for="item in dictInfo.positionRank" :key="item.value"
                                                :label="item.label" :value="item.value">
                                            </el-option>
                                        </el-select>


                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="register-form-label control-label" style="font-weight:bold">
                                        <span class="required">*</span>所属职能
                                    </label>
                                    <div class="register-form-control">
                                       
                                        <div class="select_input" style="width: 450px;" @click="showSelectUserAffiliation(form,'functionalAffiliation','functionalAffiliationName')">
                                            <span>{{form.functionalAffiliationName}}</span>
                                        </div>
                                


                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="register-form-label control-label">
                                        <span class="required"></span>直接上级职级
                                    </label>
                                    <div class="register-form-control">
                                        <el-select v-model="form.directSuperiorRank" placeholder="请选择"
                                            style="width: 450px;">
                                            <el-option v-for="item in dictInfo.positionRank" :key="item.value"
                                                :label="item.label" :value="item.value">
                                            </el-option>
                                        </el-select>


                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="register-form-label control-label">
                                        <span class="required"></span>直接上级简介
                                    </label>
                                    <div class="register-form-control">
                                        <textarea class="form-control" placeholder="请输入直接上级简介"
                                            v-model="form.directSuperiorIntroduction"></textarea>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="register-form-label control-label">
                                        <span class="required"></span>下属情况
                                    </label>
                                    <div class="register-form-control">
                                        <input id="jobname" type="text" class="form-control" placeholder="请输入下属情况"
                                            v-model="form.subordinateSituation">

                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="register-form-label control-label">
                                        <span class="required"></span>平级岗位
                                    </label>
                                    <div class="register-form-control">
                                        <input id="jobname" type="text" class="form-control" placeholder="请输入平级岗位"
                                            v-model="form.equalPost">

                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="register-form-label control-label" style="font-weight:bold"><span
                                            class="required">*</span>岗位职责</label>
                                    <div class="register-form-control"
                                        style="border: 1px solid #e6e6e6;width: 450px;margin-left: 15px;">
                                        <!-- <textarea rows="10" class="form-control jobdesc" placeholder="请输入岗位职责" id="jobdesc" v-model="form.jobDescription"></textarea> -->


                                        <Toolbar style="border-bottom: 1px solid #ccc" :editor="editorNext"
                                            :defaultConfig="toolbarConfig" :mode="mode" />
                                        <Editor style="height: 350px; overflow-y: hidden" v-model="form.jobDescription"
                                            @onCreated="onCreatedNext" :defaultConfig="editorConfig" :mode="mode" />




                                    </div>
                                </div>

                                <div class="register-tag">薪资待遇</div>

                                <div class="form-group">
                                    <label class="register-form-label control-label" style="font-weight:bold"><span
                                            class="required">*</span>税前年薪合计</label>
                                    <div class="register-form-control">

                                        <input id="jobname" type="number" style="width: 180px;" class="form-control"
                                            placeholder="请输入税前年薪" v-model="form.preTaxAnnualSalaryStart">
                                        至

                                        <input id="jobname" type="number" style="width: 180px;" class="form-control"
                                            placeholder="请输入税前年薪" v-model="form.preTaxAnnualSalaryEnd">

                                        万元
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="register-form-label control-label"><span
                                            class="required"></span>其中:税前月薪</label>
                                    <div class="register-form-control">

                                        <input id="jobname" type="number" style="width: 180px;" class="form-control"
                                            placeholder="请输入税前年薪" v-model="form.preTaxMonthlySalaryStart">
                                        K 至

                                        <input id="jobname" type="number" style="width: 180px;" class="form-control"
                                            placeholder="请输入税前年薪" v-model="form.preTaxMonthlySalaryEnd">

                                        K
                                        <!-- <input id="jobname" type="number"  class="form-control" placeholder="请输入税前月薪" v-model="form.preTaxMonthlySalary"> -->
                                    </div>
                                </div>

                                <!-- <div class="form-group">
                                    <label class="register-form-label control-label"><span
                                            class="required"></span>年终奖金约</label>
                                    <div class="register-form-control">
                                        <input id="jobname" type="number"  class="form-control" placeholder="请输入年终奖金约" v-model="form.yearEndBonus">
                                    </div>
                                </div> -->


                                <div class="form-group">
                                    <label class="register-form-label control-label"><span
                                            class="required"></span>补贴福利</label>
                                    <div class="register-form-control">
                                        <input id="jobname" type="text" class="form-control" placeholder="请输入补贴福利"
                                            v-model="form.subsidyWelfare">
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="register-form-label control-label"><span
                                            class="required"></span>股权激励情况</label>
                                    <div class="register-form-control">
                                        <el-select v-model="form.equityIncentive" placeholder="请选择"
                                            style="width: 450px;">
                                            <el-option v-for="item in dictInfo.equityIncentive" :key="item.value"
                                                :label="item.label" :value="item.value">
                                            </el-option>
                                        </el-select>

                                    </div>
                                </div>


                                <div class="form-group">
                                    <label class="register-form-label control-label"><span
                                            class="required"></span>作息时间</label>
                                    <div class="register-form-control">
                                        <el-select v-model="form.workTime" placeholder="请选择" style="width: 450px;">
                                            <el-option v-for="item in dictInfo.workTime" :key="item.value"
                                                :label="item.label" :value="item.value">
                                            </el-option>
                                        </el-select>

                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="register-form-label control-label"><span
                                            class="required"></span>出差频率</label>
                                    <div class="register-form-control">
                                        <el-select v-model="form.travelFrequency" placeholder="请选择"
                                            style="width: 450px;">
                                            <el-option v-for="item in dictInfo.travelFrequency" :key="item.value"
                                                :label="item.label" :value="item.value">
                                            </el-option>
                                        </el-select>

                                    </div>
                                </div>





                                <div class="register-tag">学历/专业等要求</div>
                                <div class="form-group">
                                    <label class="register-form-label control-label"><span
                                            class="required"></span>年龄要求</label>
                                    <div class="register-form-control ">
                                        <input id="AgeNeed" type="number" placeholder="最小年龄" v-model="form.ageStart"
                                            class="form-control" style="width: auto;"> <span>-</span>
                                        <input id="AgeNeed2" type="number" placeholder="最大年龄" v-model="form.ageEnd"
                                            class="form-control" style="width: auto;">
                                        <span style="margin-left:10px">岁</span>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="register-form-label control-label"><span
                                            class="required"></span>最低学历要求</label>
                                    <div class="register-form-control">
                                        <el-select v-model="form.lowestAcademic" placeholder="请选择"
                                            style="width: 450px;">
                                            <el-option v-for="item in dictInfo.qualification" :key="item.value"
                                                :label="item.label" :value="item.value">
                                            </el-option>
                                        </el-select>
                                        <span style="margin-left:10px">及以上</span>
                                    </div>
                                </div>

                                <div class="form-group"
                                    v-if="form.lowestAcademic == 1 || form.lowestAcademic == 2 || form.lowestAcademic == 3">
                                    <label class="register-form-label control-label"><span
                                            class="required"></span>其中,本科要求</label>
                                    <div class="register-form-control">

                                        <el-select v-model="form.universityType" multiple placeholder="不限"
                                            style="width: 195px;">
                                            <el-option label="不限" value="">
                                            </el-option>
                                            <el-option v-for="item in dictInfo.schoolType" :key="item.value"
                                                :label="item.label" :value="item.value">
                                            </el-option>
                                        </el-select>
                                        <el-select v-model="form.universityQualificationType" placeholder="不限"
                                            style="width: 195px;margin-left: 5px;">
                                            <el-option label="不限" value="">
                                            </el-option>
                                            <el-option v-for="item in dictInfo.qualificationType" :key="item.value"
                                                :label="item.label" :value="item.value">
                                            </el-option>
                                        </el-select>

                                    </div>
                                </div>




                                <div class="form-group" v-if="form.lowestAcademic == 1 || form.lowestAcademic == 2">
                                    <label class="register-form-label control-label"><span
                                            class="required"></span>硕士要求</label>
                                    <div class="register-form-control">
                                        <el-select v-model="form.masterSchoolType" multiple placeholder="不限"
                                            style="width: 195px;">
                                            <el-option label="不限" value="">
                                            </el-option>
                                            <el-option v-for="item in dictInfo.schoolType" :key="item.value"
                                                :label="item.label" :value="item.value">
                                            </el-option>
                                        </el-select>
                                        <el-select v-model="form.masterQualificationType" placeholder="不限"
                                            style="width: 195px;margin-left: 5px;">
                                            <el-option label="不限" value="">
                                            </el-option>
                                            <el-option v-for="item in dictInfo.qualificationType" :key="item.value"
                                                :label="item.label" :value="item.value">
                                            </el-option>
                                        </el-select>


                                    </div>
                                </div>



                                <div class="form-group" v-if="form.lowestAcademic == 1">
                                    <label class="register-form-label control-label"><span
                                            class="required"></span>博士要求</label>
                                    <div class="register-form-control">

                                        <el-select v-model="form.doctorSchoolType" multiple placeholder="不限"
                                            style="width: 195px;">
                                            <el-option label="不限" value="">
                                            </el-option>
                                            <el-option v-for="item in dictInfo.schoolType" :key="item.value"
                                                :label="item.label" :value="item.value">
                                            </el-option>
                                        </el-select>
                                        <el-select v-model="form.doctorQualificationType" placeholder="不限"
                                            style="width: 195px;margin-left: 5px;">
                                            <el-option label="不限" value="">
                                            </el-option>
                                            <el-option v-for="item in dictInfo.qualificationType" :key="item.value"
                                                :label="item.label" :value="item.value">
                                            </el-option>
                                        </el-select>

                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="register-form-label control-label">指定学校</label>
                                    <div class="register-form-control">
                                        <input id="professionalneed" type="text" class="form-control" placeholder="不限"
                                            v-model="form.fromSchool">
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="register-form-label control-label">指定专业</label>
                                    <div class="register-form-control">
                                        <input id="professionalneed" type="text" class="form-control" placeholder="不限"
                                            v-model="form.professionalRequirements">
                                    </div>
                                </div>



                                <div class="register-tag">行业、岗位经验整体要求</div>


                                <div class="form-group">
                                    <label class="register-form-label control-label">工作</label>
                                    <div class="register-form-control">
                                        <input id="professionalneed" type="number" style="width: 195px;"
                                            class="form-control" placeholder="不限"
                                            v-model="form.infoExperienceRequirements.workYear">
                                        年以上,其中：

                                    </div>

                                </div>
                                <template v-for="(json, index) in form.infoExperienceRequirements.items">
                                    <div class="form-group">
                                        <label class="register-form-label control-label" v-if="index == 0">在</label>
                                        <label class="register-form-label control-label" v-if="index != 0">
                                            <el-select v-model="json.conditionStr" placeholder=""
                                                @change="changeWorkLink" v-if="index != 0"
                                                style="width: 60px;margin-right: 18px;">
                                                <el-option label="或" value="or">
                                                </el-option>
                                                <el-option label="且" value="and">
                                                </el-option>
                                            </el-select>
                                            在
                                        </label>
                                        <div class="register-form-control" style="display: flex;align-items: center;justify-content: flex-start;">
                                    

                                            

                                        

                                            <div class="select_input" style="width: 450px;" @click="showSelectEnterpriseIndustry(json,'industry','enterpriseIndustryName')">
                                                <span>{{json.enterpriseIndustryName}}</span>
                                            </div>

                                            <span style="margin-left: 10px;">行业中,</span>
                                     
                                              


                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label class="register-form-label control-label">的</label>
                                        <div class="register-form-control">
                                            <el-select v-model="json.enterpriseNature" multiple placeholder="请选择企业性质"
                                                style="width: 195px;">
                                                <el-option label="不限" value="">
                                                </el-option>
                                                <el-option v-for="item in dictInfo.enterpriseNature" :key="item.value"
                                                    :label="item.label" :value="item.value">
                                                </el-option>
                                            </el-select>
                                            <el-select v-model="json.enterpriseScale" multiple placeholder="请选择企业规模"
                                                style="width: 195px;margin-left:10px">
                                                <el-option label="不限" value="">
                                                </el-option>
                                                <el-option v-for="item in dictInfo.enterpriseScale" :key="item.value"
                                                    :label="item.label" :value="item.value">
                                                </el-option>
                                            </el-select>

                                            <el-select v-model="json.listingType" multiple placeholder="请选择上市类型"
                                                style="width: 195px;margin-left:10px">
                                                <el-option label="不限" value="">
                                                </el-option>
                                                <el-option v-for="item in dictInfo.listingType" :key="item.value"
                                                    :label="item.label" :value="item.value">
                                                </el-option>
                                            </el-select>

                                            <span>企业中,</span>


                                        </div>

                                    </div>

                                    <div class="form-group">
                                        <label class="register-form-label control-label">且企业人数不低于</label>
                                        <div class="register-form-control">
                                            <input id="professionalneed" type="number" style="width:195px"
                                                class="form-control" placeholder="请输入人数" v-model="json.staffsNum">
                                            <span style="margin-left:10px">企业营收(产能)不低于</span>

                                            <input id="professionalneed" type="number" class="form-control"
                                                style="width:195px;margin-left:10px" placeholder="企业营收(产能)"
                                                v-model="json.annualRevenue"><span style="margin-left:10px">万元<span
                                                    v-if="json.annualRevenue >= 10000"
                                                    style="margin-left:10px;color:red;">({{ json.annualRevenue / 10000 }}亿)</span>,</span>

                                        </div>

                                    </div>


                                    <div class="form-group">
                                        <label class="register-form-label control-label">从事</label>

                                        <div class="register-form-control" style="display: flex;align-items: center;justify-content: flex-start;">
                                            <div class="select_input" style="width: 400px;" @click="showSelectUserAffiliation(json,'functionalAffiliation','functionalAffiliationName')">
                                                <span>{{json.functionalAffiliationName}}</span>
                                            </div>
                                            <span style="margin-left: 10px;">方向的工作,</span>
                                        </div>
                                      
                                    </div>
                                    <div class="form-group">
                                        <label class="register-form-label control-label">且担任：</label>
                                        <div class="register-form-control">
                                            <div class="addmain" style="margin-top: 0px;">
                                                <el-select v-model="json.positionRank" multiple placeholder="请选择职级"
                                                    style="width: 450px;">
                                                    <el-option label="不限" value="">
                                                    </el-option>
                                                    <el-option v-for="item in dictInfo.positionRank" :key="item.value"
                                                        :label="item.label" :value="item.value">
                                                    </el-option>
                                                </el-select>

                                                <input id="professionalneed" style="width: 95px;margin-left: 10px;"
                                                    type="number" class="form-control" placeholder="不限"
                                                    v-model="json.engagedYear"><span
                                                    style="margin-left:10px">年以上。</span>
                                                <a class="BusinessLicense" style="margin-left: 5px;" v-if="index != 0">
                                                    <span @click="deleteWork(form.infoExperienceRequirements, index)"
                                                        style="color: #F5792A;">删除</span></a>
                                                <div class="add_btn"
                                                    v-if="index == form.infoExperienceRequirements.items.length - 1"
                                                    @click="addInfoExperienceRequirements" style="margin-left: 10px;">
                                                    <span>+</span>
                                                </div>
                                            </div>
                                        </div>
                                    </div>


                                </template>
                                <div class="form-group">
                                    <label class="register-form-label control-label">目前年薪不低于</label>
                                    <div class="register-form-control">
                                        <input id="professionalneed" type="number" style="width:200px"
                                            class="form-control"
                                            v-model="form.infoExperienceRequirements.annualSalaryNotLess">
                                        <span style="margin-left: 10px;">万元。</span>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="register-form-label control-label">职业稳定度</label>
                                    <div class="register-form-control">
                                        <el-select v-model="form.infoExperienceRequirements.careerStability"
                                            placeholder="请选择职业稳定度" style="width: 450px;">
                                            <el-option label="不限" value="">
                                            </el-option>
                                            <el-option v-for="item in dictInfo.careerStability" :key="item.value"
                                                :label="item.label" :value="item.value">
                                            </el-option>
                                        </el-select>
                                        <span>。</span>

                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="register-form-label control-label">其他要求</label>
                                    <div class="register-form-control">
                                        <div class="register-form-control"
                                            style="border: 1px solid #e6e6e6;width: 450px;margin-left: 0px;">
                                            <!-- <textarea rows="10" class="form-control jobdesc" placeholder="请输入岗位职责" id="jobdesc" v-model="form.jobDescription"></textarea> -->


                                            <Toolbar style="border-bottom: 1px solid #ccc" :editor="editorNextThree"
                                                :defaultConfig="toolbarConfig" :mode="mode" />
                                            <Editor style="height: 200px; overflow-y: hidden"
                                                v-model="form.infoExperienceRequirements.otherRequirements"
                                                @onCreated="onCreatedNextThree" :defaultConfig="editorConfig"
                                                :mode="mode" />




                                        </div>
                                    </div>
                                </div>
                                <template v-for="(json, index) in form.infoJobRequirementsKeyUnit">

                                    <div class="register-tag" style="justify-content:space-between">
                                        <div class="left_div">
                                            关键单位、岗位任职要求：
                                        </div>

                                        <div class="right_div">
                                            <a class="BusinessLicense" style="margin-left: 5px;" v-if="index != 0"> <span
                                                    @click="deleteWork(form.infoJobRequirementsKeyUnit, index)"
                                                    style="color: #F5792A;">删除</span></a>
                                            <div class="add_btn" @click="addInfoJobRequirementsKeyUnit"
                                                style="margin-left: 10px;float:right"
                                                v-if="index == form.infoJobRequirementsKeyUnit.length - 1">
                                                <span>+</span>
                                            </div>

                                        </div>

                                    </div>


                                    <div class="form-group">
                                        <label class="register-form-label control-label">近</label>
                                        <div class="register-form-control">
                                            <input id="professionalneed" type="number"
                                                style="width: 50px;margin-right:10px;" class="form-control"
                                                placeholder="" v-model="json.inRecentYear">年内，




                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label class="register-form-label control-label">在目标企业</label>
                                        <div class="register-form-control">
                                            <input id="professionalneed" type="text" class="form-control"
                                                placeholder="多个用,隔开" v-model="json.company">


                                            <span>,</span>

                                        </div>
                                    </div>


                                    <div class="form-group">
                                        <label class="register-form-label control-label">或在</label>
                                        <div class="register-form-control" style="display: flex;align-items: center;justify-content: flex-start;">

                                        

                                            <div class="select_input" style="width: 450px;" @click="showSelectEnterpriseIndustry(json,'enterpriseIndustry','enterpriseIndustryName')">
                                                <span>{{json.enterpriseIndustryName}}</span>
                                            </div>

                                            <span style="margin-left: 10px;">行业中,</span>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="register-form-label control-label">的</label>
                                        <div class="register-form-control">
                                            <el-select v-model="json.enterpriseNature" multiple placeholder="请选择企业性质"
                                                style="width: 195px;">
                                                <el-option label="不限" value="">
                                                </el-option>
                                                <el-option v-for="item in dictInfo.enterpriseNature" :key="item.value"
                                                    :label="item.label" :value="item.value">
                                                </el-option>
                                            </el-select>
                                            <el-select v-model="json.enterpriseScale" multiple placeholder="请选择企业规模"
                                                style="width: 195px;margin-left:10px">
                                                <el-option label="不限" value="">
                                                </el-option>
                                                <el-option v-for="item in dictInfo.enterpriseScale" :key="item.value"
                                                    :label="item.label" :value="item.value">
                                                </el-option>
                                            </el-select>

                                            <el-select v-model="json.listingType" multiple placeholder="请选择上市类型"
                                                style="width: 195px;margin-left:10px">
                                                <el-option label="不限" value="">
                                                </el-option>
                                                <el-option v-for="item in dictInfo.listingType" :key="item.value"
                                                    :label="item.label" :value="item.value">
                                                </el-option>
                                            </el-select>
                                            <span style="margin-left: 10px;">企业中,</span>

                                        </div>

                                    </div>

                                    <div class="form-group">
                                        <label class="register-form-label control-label">且企业人数不低于</label>
                                        <div class="register-form-control">
                                            <input id="professionalneed" type="number" style="width:195px"
                                                class="form-control" placeholder="请输入人数" v-model="json.staffsNum">
                                            <span style="margin-left:10px">企业营收(产能)不低于</span>

                                            <input id="professionalneed" type="number" class="form-control"
                                                style="width:195px;margin-left:10px" placeholder="企业营收(产能)"
                                                v-model="json.annualRevenue"><span style="margin-left:10px">万元<span
                                                    style="color:red;margin-left:10px"
                                                    v-if="json.annualRevenue >= 10000">({{ json.annualRevenue / 10000 }}亿)</span>,</span>

                                        </div>

                                    </div>


                                    <div class="form-group">
                                        <label class="register-form-label control-label">从事:</label>
                                        <div class="register-form-control" style="display: flex;align-items: center;justify-content: flex-start;">
                                            <div class="select_input" style="width: 400px;" @click="showSelectUserAffiliation(json,'functionalAffiliation','functionalAffiliationName')">
                                                <span>{{json.functionalAffiliationName}}</span>
                                            </div>
                                         


                                            <span style="margin-left: 10px;">方向的工作,</span>





                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="register-form-label control-label">且担任</label>
                                        <div class="register-form-control">
                                            <el-select v-model="json.postRank" multiple placeholder="请选择职级"
                                                style="width: 450px;">
                                                <el-option label="不限" value="">
                                                </el-option>
                                                <el-option v-for="item in dictInfo.positionRank" :key="item.value"
                                                    :label="item.label" :value="item.value">
                                                </el-option>
                                            </el-select>
                                            <input id="professionalneed" type="number"
                                                style="width: 50px;margin:0 10px;" class="form-control" placeholder=""
                                                v-model="json.workYear">
                                            <span>年以上。</span>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="register-form-label control-label">管理人数不低于</label>
                                        <div class="register-form-control">

                                            <input id="professionalneed" type="number" style="width:95px;"
                                                class="form-control" placeholder="不限" v-model="json.numberManagers">
                                            <span style="margin-left:10px">人。</span>

                                        </div>
                                    </div>

                                </template>
                                <!-- 
                                <div class="add_list">
                                    
                                </div> -->

                                <div class="register-tag" @click="showCertificate=!showCertificate">
                                    证书要求
                                    <i class="iconfont icon-zhankai" v-if="!showCertificate"></i>
                                    <i class="iconfont icon-shouqi" v-if="showCertificate"></i>
                                </div>


                                <template v-if="showCertificate">

                                    <div class="form-group">
                                        <label class="register-form-label control-label">同时持有证书</label>
                                        <div class="register-form-control">
                                            <input id="professionalneed" type="text" class="form-control"
                                                placeholder='可多个，用"，"分隔' v-model="form.certificateOne">
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label class="register-form-label control-label">或持有证书</label>
                                        <div class="register-form-control">
                                            <input id="professionalneed" type="text" class="form-control"
                                                placeholder='可多个，用"，"分隔' v-model="form.certificateTwo">
                                        </div>
                                    </div>
                                </template>

                                <div class="register-tag" @click="showLanguage=!showLanguage">
                                    语言要求
                                    <i class="iconfont icon-zhankai" v-if="!showLanguage"></i>
                                    <i class="iconfont icon-shouqi" v-if="showLanguage"></i>
                                </div>

                                <template v-if="showLanguage">
                                    <div class="form-group">
                                        <label class="register-form-label control-label">具备以下语言能力</label>
                                        <div class="register-form-control">
                                            <el-select v-model="form.languageAbilityOne" placeholder="请选择语言"
                                                style="width: 195px;">
                                                <el-option v-for="item in dictInfo.language" :key="item.value"
                                                    :label="item.label" :value="item.value">
                                                </el-option>
                                            </el-select>
                                            <el-select v-model="form.languageOneRequirements" placeholder="请选择语言要求"
                                                style="width: 195px;margin-left: 10px;">
                                                <el-option v-for="item in dictInfo.languageAbility" :key="item.value"
                                                    :label="item.label" :value="item.value">
                                                </el-option>
                                            </el-select>

                                        </div>
                                    </div>


                                    <div class="form-group">
                                        <label class="register-form-label control-label">或具备以下语言能力</label>
                                        <div class="register-form-control">
                                            <el-select v-model="form.languageAbilityTwo" placeholder="请选择语言"
                                                style="width: 195px;">
                                                <el-option v-for="item in dictInfo.language" :key="item.value"
                                                    :label="item.label" :value="item.value">
                                                </el-option>
                                            </el-select>
                                            <el-select v-model="form.languageTwoRequirements" placeholder="请选择语言要求"
                                                style="width: 195px;margin-left: 10px;">
                                                <el-option v-for="item in dictInfo.languageAbility" :key="item.value"
                                                    :label="item.label" :value="item.value">
                                                </el-option>
                                            </el-select>
                                        </div>
                                    </div>
                                </template>

                                <div class="register-tag" @click="showAddress=!showAddress">
                                    地点要求
                                     <i class="iconfont icon-zhankai" v-if="!showAddress"></i>
                                    <i class="iconfont icon-shouqi" v-if="showAddress"></i>
                                </div>
                                <template v-if="showAddress">

                               
                                    <div class="form-group">
                                        <label class="register-form-label control-label">现工作地要求</label>
                                        <div class="register-form-control">


                                
                                                <div class="addmain">


                                                    <div class="am_left">
                                                        <select-address :addressData="currentWorkplaceRequirementsSelect" @sureAddress="surecurrentAddress($event,currentWorkplaceRequirementsSelect)" :chinaData="chinaData" :otherData="otherData"></select-address>
                                                    </div>


                                                

                                                </div>
                                          


                                            <!-- <input id="professionalneed" type="text" class="form-control" placeholder="不限" v-model="form.currentWorkplaceRequirements"> -->
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label class="register-form-label control-label">曾经工作地要求</label>
                                        <div class="register-form-control">

                                    
                                                <div class="addmain">


                                                    <div class="am_left">
                                                        <select-address :addressData="previousWorkplaceRequirementsSelect" @sureAddress="surepreviousAddress($event,previousWorkplaceRequirementsSelect)"  :chinaData="chinaData" :otherData="otherData"></select-address>
                                                    </div>

                                                

                                                </div>
                                          

                                            <!-- <input id="professionalneed" type="text" class="form-control" placeholder="不限" v-model="form.previousWorkplaceRequirements"> -->
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label class="register-form-label control-label">定居要求</label>
                                        <div class="register-form-control">
                                        
                                                <div class="addmain">


                                                    <div class="am_left">
                                                        <select-address :addressData="settlementRequirementsSelect" @sureAddress="suresettlementAddress($event,settlementRequirementsSelect)" :chinaData="chinaData" :otherData="otherData"></select-address>
                                                    </div>
                                                  

                                                </div>
                                       

                                            <!-- <input id="professionalneed" type="text" class="form-control" placeholder="不限" v-model="form.settlementRequirements"> -->
                                        </div>
                                    </div>
                                </template>

                                <div class="register-tag">保密设置</div>
                                <div class="form-group">
                                    <label class="register-form-label control-label">匿名发布</label>
                                    <div class="register-form-control">
                                        <el-select v-model="form.infoSecrecy.anonymouslyPublish" placeholder="请选择"
                                            style="width: 450px;">
                                            <el-option v-for="item in dictInfo.yn" :key="item.value" :label="item.label"
                                                :value="item.value">
                                            </el-option>
                                        </el-select>

                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="register-form-label control-label"></label>
                                    <div class="register-form-control">

                                        <div class="send_txt">
                                            <span>1、匿名(保密)招聘只有招聘负责人可以看到该岗位；<br></span>
                                            <span>2、匿名(保密)岗位求职者看不到企业名字、企业介绍等信息。</span>
                                        </div>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="register-form-label control-label">目前在职</label>
                                    <div class="register-form-control">
                                        <input id="professionalneed" class="form-control" placeholder="请填写公司名称"
                                            v-model="form.infoSecrecy.notCompanyCurrentlyEmployed">
                                        <span style="margin-left:10px">公司的求职者不能检索、投递</span>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="register-form-label control-label">曾经在职</label>
                                    <div class="register-form-control">
                                        <input id="professionalneed" class="form-control" placeholder="请填写公司名称"
                                            v-model="form.infoSecrecy.notCompanyPreviouslyEmployed">
                                        <span style="margin-left:10px">公司的求职者不能检索、投递</span>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="register-form-label control-label">对</label>
                                    <div class="register-form-control">
                                        <el-select v-model="form.infoSecrecy.publiclyAccounts" placeholder="请选择"
                                            style="width: 450px;">
                                            <el-option label="全部" value="">

                                            </el-option>

                                            <!-- <el-option
                                            v-for="item in dictInfo.yn"
                                            :key="item.value"
                                            :label="item.label"
                                            :value="item.value">
                                            </el-option> -->
                                        </el-select>
                                        <span style="margin-left:10px">子账户公开</span>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="register-form-label control-label">岗位招聘负责人</label>
                                    <div class="register-form-control">
                                        <input id="professionalneed" type="text" class="form-control"
                                            placeholder="请输入岗位招聘负责人" v-model="form.jobRecruitmentManager">
                                    </div>
                                </div>
                            </form>
                        </div>
                        <div class="register-action">
                            <input type="button" value="保存岗位" class="btn btn-primary btn-lg savejob"
                                @click="savePost('2')">
                            <input type="button" value="保存且发布" class="btn btn-primary btn-lg savepublishjob"
                                @click="savePost('1')" style="margin-left:30px">
                        </div>
                    </div>

                </div>

            </div>
            <post-footer-main-vue></post-footer-main-vue>
        </div>

        <enterprise-industry @closeSelect="closeSelect" :haveSelect="haveSelect" v-if="showSelectIndustry" @saveData="saveData" :title="'选择行业'" :selectArry="enterpriseIndustry"></enterprise-industry>


        <enterprise-industry @closeSelect="closeSelectAffiliation" :haveSelect="haveSelect" v-if="showSelectAffiliation" @saveData="saveData" :title="'选择职能'" :selectArry="functionalAffiliationList"></enterprise-industry>


    </div>
</template>
<script>

import postHead from '@/components/postHead.vue';
import homeapi from '@/api/api.js'
import until from '@/api/until'
import { Editor, Toolbar } from "@wangeditor/editor-for-vue";
import postFooterMainVue from '@/components/postFooterMain.vue';
import selectAddress from '@/components/selectAddress.vue'
import enterpriseIndustry from '@/components/enterPriseindustry.vue'

export default {
    name: 'login',
    data() {
        return {
            phone: "",
            haveCheck: false,
            code: "",
            title: "",
            loginType: 1,
            loginCode: 1,
            active: 2,

            editorConfig: {

            },
           
            editor: null,
            editorNext: null,
            editorNextThree: null,
            mode: "default", // 'default' or 'simple'
            toolbarConfig: {
                toolbarKeys: [//自定义菜单选项，显示的选项

                    "bold",

                    "bgColor",
                ],
                excludeKeys: [//隐藏掉的选项

                    "sub",
                    "sup",
                ],
            },


            workSelect: [

            ],
            previousWorkplaceRequirementsSelect: [],
            settlementRequirementsSelect: [],
            currentWorkplaceRequirementsSelect: [],
            form: {
                jobSlogan: "",
                postImg: "",
                postImgUrl: "",
                name: "",
                postType: "1",
                num: "",
                reason: "",
                urgency: "",
                companyId: "",
                companyName: "",
                department: "",
                departmentIntroduction: "",
                positionRank: "",
                functionalAffiliation: "",
                directSuperiorRank: "",
                directSuperiorIntroduction: "",
                subordinateSituation: "",
                equalPost: "",
                preTaxAnnualSalaryEnd: "",
                preTaxAnnualSalaryStart: "",
                preTaxMonthlySalaryStart: '',
                preTaxMonthlySalaryEnd: "",
                yearEndBonus: "",
                subsidyWelfare: "",
                equityIncentive: "",
                workTime: "2",
                travelFrequency: "",
                workPlace: [],
                workPlaceList: [],
                jobDescription: "",
                ageStart: "",
                ageEnd: "",
                lowestAcademic: "",
                jcType: [],
                jcQualificationType: "",
                universityType: [],
                universityQualificationType: "",
                masterSchoolType: [],
                masterQualificationType: "",
                doctorSchoolType: [],
                doctorQualificationType: "",
                fromSchool: "",
                professionalRequirements: "",
                certificateOne: "",
                certificateTwo: "",
                languageAbilityOne: "",
                languageOneRequirements: "",
                languageAbilityTwo: "",
                languageTwoRequirements: "",
                currentWorkplaceRequirements: [],
                previousWorkplaceRequirements: [],
                settlementRequirements: [],
                jobRecruitmentManager: "",
                infoRewardSet: {
                    money: 0,
                },
                infoSecrecy: {
                    anonymouslyPublish: "0",
                    constituentCompanyId: "",
                    notCompanyCurrentlyEmployed: "",
                    notCompanyPreviouslyEmployed: "",
                    publiclyAccounts: "",
                },
                infoExperienceRequirements: {

                    annualSalaryNotLess: "",
                    careerStability: "",
                    otherRequirements: "",
                    workYear: '',
                    items: [
                        {
                            conditionStr: "",
                            engagedYear: "",
                            functionalAffiliation: [],
                            industry: [],
                            positionRank: [],
                            enterpriseNature: [],
                            enterpriseScale: [],
                            listingType: [],
                            staffsNum: '',
                            annualRevenue: "",

                        }
                    ]

                },
                infoJobRequirementsKeyUnit: [
                    {
                        annualRevenue: "",
                        company: "",
                        engagedIn: "",
                        enterpriseIndustry: [],
                        enterpriseNature: [],
                        enterpriseScale: [],
                        functionStr: "",
                        inRecentYear: "",
                        listingType: [],
                        numberManagers: "",
                        positionHeld: "",
                        rank: "",
                        staffsNum: "",
                        workYear: "",
                    }
                ],
                infoOther: {
                    attachment: "",
                    soundRecording: "",
                },
                status: "",


            },

            userForm: {
                inviteCode: "",
                inviter: "",
                inviterPhone: "",
                name: "",
                nickName: "",
                workplace: "",
                idCard: "",
                personHighestDegree: {

                },
                personImportantUnits: {

                }
            },
            enterpriseScaleList: [],
            enterpriseIndustry: [],
            enterpriseNatureList: [],
            staffsNumList: [],


            cateProps: {
                value: "value",
                label: "label",
                children: "children",
            },
            props: {
                value: "id",
                label: "text",
                children: "children",
                multiple: true,

            },
            workProps: {
                value: "id",
                label: "name",
                children: "child",
                multiple: true,
                lazy: true,
                lazyLoad(node, resolve) {
                }
            },
            showCode: true,
            time: 60,
            dictInfo: {},

            functionalAffiliationList: [],
            companyList: [],

            workPlaceList: [],
            workPlaceSecondList: [],
            contentMain: '',
            postId: "",

            chinaData:[],
            otherData:[],
            
            showSelectAffiliation:false,
            showSelectIndustry:false,
            showCertificate:false,
            showLanguage:false,
            showAddress:false,


        }
    },
    components: {
        postHead, Editor, Toolbar, postFooterMainVue,enterpriseIndustry,selectAddress
    },
    mounted() {
        let title = this.$route.query.title

        if (title) {
            this.title = title
        }
        else {
            this.title = "AI爱招聘-添加岗位"
        }
        this.postId = this.$route.query.id;


        this.getDictList();
        this.getIndustryList();
        this.getFunctionalffiliationList();
        this.getCompanyInfo();
        this.getChildCompanyList();
        this.getWorkSpace();
        this.getContentType();
        this.getChinaData();
        this.getOtherData();
        // this.getChinaCountry();
    },
    methods: {
        sureAddress(selectAddress){
            this.workSelect=JSON.parse(JSON.stringify(selectAddress));
        },
        surecurrentAddress(selectAddress){
            this.currentWorkplaceRequirementsSelect=JSON.parse(JSON.stringify(selectAddress));
        },
        surepreviousAddress(selectAddress){
            this.previousWorkplaceRequirementsSelect=JSON.parse(JSON.stringify(selectAddress));
        },
        suresettlementAddress(){
            this.settlementRequirementsSelect=JSON.parse(JSON.stringify(selectAddress));
        },



        closeSelectAffiliation(){
            this.showSelectAffiliation=false;
        },
        
        saveData(item){
            this.nowItem[this.nowType]=item.arryList
            this.nowItem[this.nowName]=item.arryName
            this.closeSelect();
            this.closeSelectAffiliation();
        },

        showSelectEnterpriseIndustry(nowItem,nowType,nowName){
            this.nowItem=nowItem
            this.nowType=nowType
            this.nowName=nowName

            this.haveSelect=nowItem[nowType]

            this.showSelectIndustry=true
        },
        showSelectUserAffiliation(nowItem,nowType,nowName){
            this.nowItem=nowItem
            this.nowType=nowType
            this.nowName=nowName

            this.haveSelect=nowItem[nowType]

            this.showSelectAffiliation=true
        },
        
        closeSelect(){
            this.showSelectIndustry=false;
        },



          //获取中国的数据
        async getChinaData(){
            let data=await homeapi.getCountryTree({id:"1881965479771557890"})
            if(data.code==200){
                this.chinaData=data.result
            }   
        },

          //获取其他数据
        async getOtherData(){
            let data = await homeapi.getWorkSpaceList();
            if (data.code == 200) {
                
               
                let newData=[];
                data.result.map(res=>{
                    if(res.child){
                        res.child.map((json,index)=>{
                            if(json.name.indexOf('中国')>-1){
                                res.child.splice(index,1);
                            }
                        })
                    }
                })
                newData=JSON.parse(JSON.stringify(data.result))
                this.otherData = newData;
          
            }
        },

        //获取回显数据
        async getPostInfo() {
            let id = this.postId
            const data = await homeapi.getPostMain({ id });
            if (data.code == 200) {
                for (let item in data.result) {
                    if (data.result[item]) {
                        this.form[item] = data.result[item]
                    }
                    if (item == 'infoExperienceRequirements') {

                        if (data.result[item].items.length == 0) {
                            this.addInfoExperienceRequirements()
                        }

                    }
                    if (item == 'infoJobRequirementsKeyUnit') {
                        if (data.result[item].length == 0) {
                            this.addInfoJobRequirementsKeyUnit();
                        }
                    }
                    if (item === 'workPlace') {
                        if (data.result[item].length > 0) {
                            console.log("bbbbbbbbbbbbb")
                            this.workSelect = [];
                        }
                        else {
                            this.workSelect.push({
                                first: this.workPlaceList[0].id,
                                secondWorkList: this.workPlaceList[0].child,
                                second: this.workPlaceList[0].child[0].id,
                                thirdWorkList: [],
                                third: "",
                                fourthWorkList: [],
                                fourth: "",
                                five: "",
                                fiveWorkList: []
                            })
                            
                        }

                        data.result[item].map(json => {

                            let first = json.continentId
                            let second = json.countryId
                            let third = json.province
                            let fourth = json.city
                            let five = json.district
                            let fiveWorkList = [];
                            let secondWorkList = [];
                            let thirdWorkList = [];
                            let fourthWorkList = [];
                            if (first) {
                                this.workPlaceList.forEach(res => {
                                    if (res.id == first) {
                                        secondWorkList = res.child
                                    }
                                })
                            }
                            this.workSelect.push({
                                first: first,
                                secondWorkList: secondWorkList,
                                second: second,
                                thirdWorkList: thirdWorkList,
                                third: third,
                                fourthWorkList: fourthWorkList,
                                fourth: fourth,
                                five: five,
                                fiveWorkList: fiveWorkList
                            })
                          


                        })
                    }
                    if (item === 'currentWorkplaceRequirements') {
                        if (data.result[item].length > 0) {
                            this.currentWorkplaceRequirementsSelect = [];
                        }
                        else {
                            this.currentWorkplaceRequirementsSelect.push({
                                first: this.workPlaceList[0].id,
                                secondWorkList: this.workPlaceList[0].child,
                                second: this.workPlaceList[0].child[0].id,
                                thirdWorkList: [],
                                third: "",
                                fourthWorkList: [],
                                fourth: "",
                                five: "",
                                fiveWorkList: []
                            })
                           
                        }

                        data.result[item].map(json => {

                            let first = json.continentId
                            let second = json.countryId
                            let third = json.province
                            let fourth = json.city
                            let five = json.district
                            let fiveWorkList = [];
                            let secondWorkList = [];
                            let thirdWorkList = [];
                            let fourthWorkList = [];
                            this.workPlaceList.forEach(res => {
                                if (res.id == first) {
                                    secondWorkList = res.child
                                }
                            })
                            this.currentWorkplaceRequirementsSelect.push({
                                first: first,
                                secondWorkList: secondWorkList,
                                second: second,
                                thirdWorkList: thirdWorkList,
                                third: third,
                                fourthWorkList: fourthWorkList,
                                fourth: fourth,
                                five: five,
                                fiveWorkList: fiveWorkList
                            })
                           
                        })
                    }
                    if (item === 'previousWorkplaceRequirements') {
                        if (data.result[item].length > 0) {
                            this.previousWorkplaceRequirementsSelect = [];
                        }
                        else {
                            this.previousWorkplaceRequirementsSelect.push({
                                first: this.workPlaceList[0].id,
                                secondWorkList: this.workPlaceList[0].child,
                                second: this.workPlaceList[0].child[0].id,
                                thirdWorkList: [],
                                third: "",
                                fourthWorkList: [],
                                fourth: "",
                                five: "",
                                fiveWorkList: []
                            })
                           
                        }
                        data.result[item].map(json => {

                            let first = json.continentId
                            let second = json.countryId
                            let third = json.province
                            let fourth = json.city
                            let five = json.district
                            let fiveWorkList = [];
                            let secondWorkList = [];
                            let thirdWorkList = [];
                            let fourthWorkList = [];
                            this.workPlaceList.forEach(res => {
                                if (res.id == first) {
                                    secondWorkList = res.child
                                }
                            })
                            this.previousWorkplaceRequirementsSelect.push({
                                first: first,
                                secondWorkList: secondWorkList,
                                second: second,
                                thirdWorkList: thirdWorkList,
                                third: third,
                                fourthWorkList: fourthWorkList,
                                fourth: fourth,
                                five: five,
                                fiveWorkList: fiveWorkList
                            })
                           

                        })
                    }


                    if (item === 'settlementRequirements') {
                        if (data.result[item].length > 0) {
                            this.settlementRequirementsSelect = [];
                        }
                        else {
                            this.settlementRequirementsSelect.push({
                                first: this.workPlaceList[0].id,
                                secondWorkList: this.workPlaceList[0].child,
                                second: this.workPlaceList[0].child[0].id,
                                thirdWorkList: [],
                                third: "",
                                fourthWorkList: [],
                                fourth: "",
                                five: "",
                                fiveWorkList: []
                            })
                          
                        }
                        data.result[item].map(json => {

                            let first = json.continentId
                            let second = json.countryId
                            let third = json.province
                            let fourth = json.city
                            let five = json.district
                            let fiveWorkList = [];
                            let secondWorkList = [];
                            let thirdWorkList = [];
                            let fourthWorkList = [];
                            this.workPlaceList.forEach(res => {
                                if (res.id == first) {
                                    secondWorkList = res.child
                                }
                            })
                            this.settlementRequirementsSelect.push({
                                first: first,
                                secondWorkList: secondWorkList,
                                second: second,
                                thirdWorkList: thirdWorkList,
                                third: third,
                                fourthWorkList: fourthWorkList,
                                fourth: fourth,
                                five: five,
                                fiveWorkList: fiveWorkList
                            })
                           

                        })
                    }

                }
                // this.form=data.result;
                this.form.id = this.postId
            }
        },

    

        async getContentType() {
            let type = 1;
            const data = await homeapi.getContentType({ type });
            if (data.code == 200) {
                this.contentMain = data.result.content
            }

        },
        deleteWork(worklist, index) {
            worklist.splice(index, 1)
        },

        addInfoExperienceRequirements() {
            this.form.infoExperienceRequirements.items.push({
                engagedYear: "",
                functionalAffiliation: [],
                industry: [],
                positionRank: "",

                workYear: "",
                conditionStr: 'or',
                enterpriseNature: [],
                enterpriseScale: [],
                listingType: [],
                staffsNum: '',
                annualRevenue: "",
            })
        },
        addInfoJobRequirementsKeyUnit() {
            this.form.infoJobRequirementsKeyUnit.push({
                annualRevenue: "",
                company: "",
                engagedIn: "",
                enterpriseIndustry: [],
                enterpriseNature: [],
                enterpriseScale: [],
                functionStr: "",
                inRecentYear: "",
                listingType: [],
                numberManagers: "",
                positionHeld: "",
                rank: "",
                staffsNum: "",
                workYear: "",
            })
        },
        addWork() {
            this.workSelect.push({
                first: this.workPlaceList[0].id,
                secondWorkList: this.workPlaceList[0].child,
                second: this.workPlaceList[0].child[0].id,
                thirdWorkList: [],
                third: "",
                fourthWorkList: [],
                fourth: "",
                five: "",
                fiveWorkList: [],
            })

        },
        addCurrentWork() {
            this.currentWorkplaceRequirementsSelect.push({
                first: this.workPlaceList[0].id,
                secondWorkList: this.workPlaceList[0].child,
                second: this.workPlaceList[0].child[0].id,
                thirdWorkList: [],
                third: "",
                fourthWorkList: [],
                fourth: "",
                five: "",
                fiveWorkList: [],
            })
           
        },
        addPreviousWork() {
            this.previousWorkplaceRequirementsSelect.push({
                first: this.workPlaceList[0].id,
                secondWorkList: this.workPlaceList[0].child,
                second: this.workPlaceList[0].child[0].id,
                thirdWorkList: [],
                third: "",
                fourthWorkList: [],
                fourth: "",
                five: "",
                fiveWorkList: [],
            })
           
        },
        addSettlementWork() {
            this.settlementRequirementsSelect.push({
                first: this.workPlaceList[0].id,
                secondWorkList: this.workPlaceList[0].child,
                second: this.workPlaceList[0].child[0].id,
                thirdWorkList: [],
                third: "",
                fourthWorkList: [],
                fourth: "",
                five: "",
                fiveWorkList: [],
            })
           
        },
        onCreated(editor) {
            this.editor = Object.seal(editor); // 一定要用 Object.seal() ，否则会报错
            this.toolbarConfig = {
                toolbarKeys: [//自定义菜单选项
                    "fontSize",
                    "bold",
                    "color",
                    "bgColor",
                    "justifyLeft",
                    "justifyRight",
                    "justifyCenter",
                    "justifyJustify"
                ],
                excludeKeys: [

                    "sub",
                    "sup",
                ],
            };
        },
        onCreatedNext(editor) {
            this.editorNext = Object.seal(editor);
            console.log(this.editorNext.getAllMenuKeys())  // 一定要用 Object.seal() ，否则会报错
            this.toolbarConfig = {
                toolbarKeys: [//自定义菜单选项


                    "fontSize",
                    "bold",

                    "color",
                    "bgColor",
                    "justifyLeft",
                    "justifyRight",
                    "justifyCenter",
                    "justifyJustify"
                ],
                excludeKeys: [

                    "sub",
                    "sup",
                ],
            };
        },
        onCreatedNextThree(editor) {
            this.editorNextThree = Object.seal(editor); // 一定要用 Object.seal() ，否则会报错
            this.toolbarConfig = {
                toolbarKeys: [//自定义菜单选项


                    "fontSize",
                    "bold",

                    "color",
                    "bgColor",
                    "justifyLeft",
                    "justifyRight",
                    "justifyCenter",
                    "justifyJustify"
                ],
                excludeKeys: [

                    "sub",
                    "sup",
                ],
            };
        },




       


     

        //获取工作地点
        async getWorkSpace() {
            let data = await homeapi.getWorkSpaceList();
            if (data.code == 200) {
                data.result.map(res => {
                    res.text = res.name
                    res.children = res.child
                    if (res.child) {
                        res.child.map(json => {
                            json.text = json.name

                        })
                    }

                })
                this.workPlaceList = data.result
                this.getPostInfo();


            }
        },
        async changeFile(e) {
            if (e.target.files.length > 0) {
                let file = e.target.files[0]
                var formData = new FormData();

                formData.append('file', file);
                let data = await homeapi.uploadFile(formData)

                if (data.code == 200) {

                    this.form.postImgUrl = data.result.url
                    this.form.postImg = data.result.path
                    console.log(this.form)
                }
            }

        },


        //获取公司信息
        async getCompanyInfo() {
            let data = await homeapi.getCompanyInfo();
            if (data.code == 200) {
                this.companyInfo = data.result
                // this.form.companyName=this.companyInfo.name
                // this.form.companyId=this.companyInfo.id
                this.form.jobRecruitmentManager = this.companyInfo.contactName
            }
        },
        //获取子公司信息
        async getChildCompanyList() {
            let data = await homeapi.getCompanyList();
            if (data.code == 200) {
                this.companyList = data.result
            }
        },

        async savePost(status) {
            let form = this.form;
            form.workPlace = [];
            form.currentWorkplaceRequirements = []
            form.previousWorkplaceRequirements = [];
            form.settlementRequirements = [];
            this.workSelect.map(res => {

                let jsonData = {
                    continentId: res.first,
                    countryId: res.second,
                    province: res.third,
                    city: res.fourth,
                    district: res.five,
                }
                form.workPlace.push(jsonData)

              
            })
            this.currentWorkplaceRequirementsSelect.map(res => {
                let jsonData = {
                    continentId: res.first,
                    countryId: res.second,
                    province: res.third,
                    city: res.fourth,
                    district: res.five,
                }
                form.currentWorkplaceRequirements.push(jsonData)

            })


            this.previousWorkplaceRequirementsSelect.map(res => {
                let jsonData = {
                    continentId: res.first,
                    countryId: res.second,
                    province: res.third,
                    city: res.fourth,
                    district: res.five,
                }
                form.previousWorkplaceRequirements.push(jsonData)
            })

            this.settlementRequirementsSelect.map(res => {
                let jsonData = {
                    continentId: res.first,
                    countryId: res.second,
                    province: res.third,
                    city: res.fourth,
                    district: res.five,
                }
                form.settlementRequirements.push(jsonData)

            })
            form.status = status;

            const loading = this.$loading({
				lock: true,
				text: '保存中...',
				spinner: 'el-icon-loading',
				background: 'rgba(0, 0, 0, 0.7)'
			});
            let data = await homeapi.editPostInfo(form)
            if (data.code == 200) {
                loading.close();
                this.$message.success("操作成功")
                this.$router.push("/post/info?id=" + form.id)
            }
        },

        toLogin() {
            this.$router.push("/login/loginnew")
        },
        setActive(type) {
            this.active = type;
        },
        //获取数据字典
        async getDictList() {
            let data = await homeapi.getDictList();
            if (data.code == 200) {
                this.dictInfo = data.result
            }
        },
        deleteImg() {
            this.form.postImg = ""
            this.form.postImgUrl = ""
        },
        //获取职能列表
        async getFunctionalffiliationList() {
            let data = await homeapi.getFunctionList();
            if (data.code == 200) {
                data.result.map(res => {
                    res.text = res.name;
                    if (res.child.length > 0) {
                        res.child.map(json => {
                            json.text = json.name
                        })
                        res.children = res.child;
                        res.children.map(json => {
                            if (json.child.length > 0) {
                                json.child.map(item => {
                                    item.text = item.name
                                })
                                json.children = json.child

                            }

                        })
                    }

                })
                this.functionalAffiliationList = data.result
            }
        },

        //获取行业列表
        async getIndustryList() {
            let data = await homeapi.getIndustryList();
            if (data.code == 200) {
                data.result.map(res => {
                    res.text = res.name;
                    if (res.child.length > 0) {
                        res.child.map(json => {
                            json.text = json.name
                        })
                        res.children = res.child;
                        res.children.map(json => {
                            if (json.child.length > 0) {
                                json.child.map(item => {
                                    item.text = item.name
                                })
                                json.children = json.child

                            }

                        })
                    }

                })

                this.enterpriseIndustry = data.result

            }
        },








        changeWorkLink(item) {
            console.log(item)
            this.form.infoExperienceRequirements.items.map(res => {
                res.workLink = item
            })
        }


    }
}

</script>

<style src="@wangeditor/editor/dist/css/style.css"></style>
<style scoped lang="less">
.container {
    width: 100%;
    height: calc(100vh - 125px);
    overflow: auto;
    margin-top: 15px;
}

.main-left {
    position: fixed;
    top: 95px;
    bottom: 30px;
    background: #fff;
}

.system-lt {
    border: 0px;
}

.system-rt {
    border: 0px;
}

.main-right {
    margin-left: 0px;
}

.navbar-header {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.navbar-header span {
    font-size: 24px;
    color: #FC7B24;
    font-weight: bold;
}

.upload_div {
    width: 80px;
    height: 80px;
    border: 1px solid #e6e6e6;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
}

.upload_div input {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
}

.upload_div i {
    font-size: 18px;
}

.add_list {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-top: 10px;
}

.add_btn {
    width: 80px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #333333;
    border: 1px solid #e6e6e6;
    border-radius: 4px;
    cursor: pointer;
    margin-left: 5px;
}

.addmain {
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.register-tag {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.rule_content {
    width: 500px;
    display: inline-block;
}

.register-form-label {
    width: 32%;
}

.right_div {
    float: right;
}

.register-tag::before {
    display: none;
}

.register-tag::after {
    display: none;
}

.register-tag{
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.right_div {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.register-info .form-control {
    height: 40px;
}

.send_txt {
    width: 450px;
    background: #e6e6e6;
    padding: 5px;
    box-sizing: border-box;
}
</style>
